<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子51-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子51

                async function f() {
                    return 'hello world';
                }

                f().then(v => console.log(v)); // "hello world"

                //--------------------------------------------------------------------------

                async function f() {
                    throw new Error('出错了');
                }

                f().then(
                    v => console.log(v),
                    e => console.log(e) // Error: 出错了
                )
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/51.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>